package com.codeman.business.crawl.domain;


import com.codeman.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 抓取单本小说任务对象 crawl_single_task
 *
 * @author ruoyi
 * @date 2021-03-19
 */
@Data
public class CrawlSingleTask {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    private Integer id;

    /**
     * 爬虫源ID
     */
    @Excel(name = "爬虫源ID")
    private int sourceId;

    /**
     * 爬虫源名
     */
    @Excel(name = "爬虫源名")
    private String sourceName;

    /**
     * 源站小说ID
     */
    @Excel(name = "源站小说ID")
    private String sourceBookId;

    /**
     * 分类ID
     */
    @Excel(name = "分类ID")
    private Integer catId;

    /**
     * 爬取的小说名
     */
    @Excel(name = "爬取的小说名")
    private String bookName;

    /**
     * 爬取的小说作者名
     */
    @Excel(name = "爬取的小说作者名")
    private String authorName;

    /**
     * 任务状态，0：失败，1：成功，2；未执行
     */
    @Excel(name = "任务状态，0：失败，1：成功，2；未执行")
    private String taskStatus;

    /**
     * 已经执行次数，最多执行5次
     */
    @Excel(name = "已经执行次数，最多执行5次")
    private byte excCount;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("sourceId", getSourceId())
                .append("sourceName", getSourceName())
                .append("sourceBookId", getSourceBookId())
                .append("catId", getCatId())
                .append("bookName", getBookName())
                .append("authorName", getAuthorName())
                .append("taskStatus", getTaskStatus())
                .append("excCount", getExcCount())
                .append("createTime", getCreateTime())
                .toString();
    }
}
